<?php 
if (isset($_POST['phone']) && !empty($_POST['phone'])){
	include_once("./core/config.php");
	$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
	if (!$mysqli->set_charset("utf8mb4")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
	$gender=$_POST['gender'];
	$name=$_POST['name'];
	$phone=$_POST['phone'];
	$result=$mysqli->query("select id from users where phone='".$phone."'  limit 0, 1");
	if($result->num_rows>0){
		echo 'exit';
	}else{
	$mysqli->query("insert into log(name,phone,create_time) values('".$name."','".$phone."', '".date("Y-m-d H:i:s")."') ");
	$mysqli->query("insert into users(gender,name,phone,create_time) values('".$gender."','".$name."', '".$phone."' ,'".date("Y-m-d H:i:s")."') ");
    echo base64_encode($phone);
	}
}
